﻿using System.Diagnostics.Contracts;

namespace System.Reactive
{
	[ContractClass(typeof(IObserverContract<,>))]
	public interface IObserver<in TValue, out TResult>
	{
		TResult OnError(Exception exception);
	}

	[ContractClassFor(typeof(IObserver<,>))]
	internal abstract class IObserverContract<TValue, TResult> : IObserver<TValue, TResult>
	{
		public TResult OnError(Exception exception)
		{
			Contract.Requires(exception != null, null, "exception != null");
			return default(TResult);
		}
	}
}